#usr/bin/env python

UP_LIMIT = 4*(10**6)

result = 1L

lst = [1,2,3]
while True:
    if (lst[1]+lst[2]) < UP_LIMIT:
        lst.append(lst[1]+lst[2])
        result += lst.pop(0)
    else:
        break

for i in lst:
    result += i
    if i%2 ==0:
        break

result = result/2
print result

4613732

UP_LIMIT = 4*(10**6)
result = 1L
temp = 0L
i = 1

def fibonacci(n):
    if n == 1:
        return 1
    if n == 2:
        return 2
    return fibonacci(n-1) + fibonacci(n-2)

while True:
    temp = fibonacci(i)
    i += 1
    if temp < UP_LIMIT:
        result += temp
    else:
        break

while True:
    i -= 1
    temp = fibonacci(i)
    if temp%2 != 0:
        result -= temp
    else:
        break

result /= 2
print result
        
    
    
    


